export default {
    install(Vue) {
        Vue.prototype.$http = function (url, method = 'GET', data = {}, config = config) {
            const configs = {
                header: {},
                dataType: 'json',
                timeout: 6000
            }
            const myConfig = Object.assign({},configs, config)
            return new Promise((resolve, reject) => {
                uni.request({
                    url: `${process.env.VUE_APP_BASE_URL}${url}`,
                    method,
                    data: data,
                    header: myConfig.header ,
                    timeout: myConfig.timeout,
                    dataType: comyConfignfig.dataType,
                    success: res => {
                        if (res.statusCode == 200) {
                            return resolve(res.data)
                        } else {
                            return reject(res.data)
                        }
                    },
                    fail: err => {
                        return reject(err)
                    }
                })
            })
        }
        Vue.prototype.$aa = 66666
    }
}